import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getTeamsInfoService } from '@/api/teams'

export const useTeamsStore = defineStore(
  'teams',
  () => {
    const teamsList = ref({})

    const getTeamsList = async () => {
      const res = await getTeamsInfoService()
      teamsList.value = res.data.data
    }

    const setTeamList = (obj) => {
      teamsList.value = obj
    }

    return { teamsList, getTeamsList, setTeamList }
  },
  {
    persist: true, // 持久化
  },
)
